#!/usr/bin/python
KB = 1024

SIZES = {
    'kB': 1024,
}

def get_report():
    output = open('/proc/meminfo').read()
    data = {}
    for line in output.split('\n'):
        bits = line.split()
        if bits:
            k = bits[0].rstrip(':')
            v = int(bits[1])
            if len(bits) == 3:
                v *= SIZES[bits[2]]
            data[k] = v
    return {
        'mem_total': data['MemTotal'],
        'active': data['Active'],
        'inactive': data['Inactive'],
        'mem_free': data['MemFree'],
        'swap_total': data['SwapTotal'],
        'swap_free': data['SwapFree'],
    }

if __name__ == '__main__':
    print get_report()
